<!DOCTYPE html>
<html lang="zh-CN">
<head>
  <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=2">
<meta name="theme-color" content="#222">
<meta name="generator" content="Hexo 5.3.0">
  <link rel="apple-touch-icon" sizes="180x180" href="/images/apple-touch-icon-next.png">
  <link rel="icon" type="image/png" sizes="32x32" href="/images/favicon-32x32-next.png">
  <link rel="icon" type="image/png" sizes="16x16" href="/images/favicon-16x16-next.png">
  <link rel="mask-icon" href="/images/logo.svg" color="#222">

<link rel="stylesheet" href="/css/main.css">


<link rel="stylesheet" href="/lib/font-awesome/css/font-awesome.min.css">

<script id="hexo-configurations">
    var NexT = window.NexT || {};
    var CONFIG = {"hostname":"example.com","root":"/","scheme":"Muse","version":"7.8.0","exturl":false,"sidebar":{"position":"left","display":"post","padding":18,"offset":12,"onmobile":false},"copycode":{"enable":false,"show_result":false,"style":null},"back2top":{"enable":true,"sidebar":false,"scrollpercent":false},"bookmark":{"enable":false,"color":"#222","save":"auto"},"fancybox":false,"mediumzoom":false,"lazyload":false,"pangu":false,"comments":{"style":"tabs","active":null,"storage":true,"lazyload":false,"nav":null},"algolia":{"hits":{"per_page":10},"labels":{"input_placeholder":"Search for Posts","hits_empty":"We didn't find any results for the search: ${query}","hits_stats":"${hits} results found in ${time} ms"}},"localsearch":{"enable":true,"trigger":"auto","top_n_per_article":1,"unescape":false,"preload":false},"motion":{"enable":true,"async":false,"transition":{"post_block":"fadeIn","post_header":"slideDownIn","post_body":"slideDownIn","coll_header":"slideLeftIn","sidebar":"slideUpIn"}},"path":"search.json"};
  </script>

  <meta name="description" content="​    这个好像是玻利维亚的一个人做的项目，在github上，仓库地址为：github.com&#x2F;ariquezada&#x2F;FFT-spectrum-analyzer。 1. 概述​    机械振动通常是总体机械状态的最佳指标，用于预防性和矫正性维修。可以使用加速度计来测量，可以得到一个指示振动最大值的整体读数，但是通常最有用的信息是用一个时间周期读数的FFT频谱分析来获得。 2. ADXL3352.">
<meta property="og:type" content="article">
<meta property="og:title" content="机械振动FFT频谱分析">
<meta property="og:url" content="http://example.com/2021/04/11/%E6%9C%BA%E6%A2%B0%E6%8C%AF%E5%8A%A8FFT%E9%A2%91%E8%B0%B1%E5%88%86%E6%9E%90/index.html">
<meta property="og:site_name" content="学无止境">
<meta property="og:description" content="​    这个好像是玻利维亚的一个人做的项目，在github上，仓库地址为：github.com&#x2F;ariquezada&#x2F;FFT-spectrum-analyzer。 1. 概述​    机械振动通常是总体机械状态的最佳指标，用于预防性和矫正性维修。可以使用加速度计来测量，可以得到一个指示振动最大值的整体读数，但是通常最有用的信息是用一个时间周期读数的FFT频谱分析来获得。 2. ADXL3352.">
<meta property="og:locale" content="zh_CN">
<meta property="og:image" content="https://xdl-blog-picture.oss-cn-shanghai.aliyuncs.com/img/微信截图_20210407153959.png">
<meta property="og:image" content="https://xdl-blog-picture.oss-cn-shanghai.aliyuncs.com/img/微信截图_20210407154850.png">
<meta property="og:image" content="https://xdl-blog-picture.oss-cn-shanghai.aliyuncs.com/img/微信截图_20210411144616.png">
<meta property="article:published_time" content="2021-04-11T06:54:00.000Z">
<meta property="article:modified_time" content="2021-04-11T06:54:00.000Z">
<meta property="article:author" content="xudonglei">
<meta property="article:tag" content="信号处理">
<meta name="twitter:card" content="summary">
<meta name="twitter:image" content="https://xdl-blog-picture.oss-cn-shanghai.aliyuncs.com/img/微信截图_20210407153959.png">

<link rel="canonical" href="http://example.com/2021/04/11/%E6%9C%BA%E6%A2%B0%E6%8C%AF%E5%8A%A8FFT%E9%A2%91%E8%B0%B1%E5%88%86%E6%9E%90/">


<script id="page-configurations">
  // https://hexo.io/docs/variables.html
  CONFIG.page = {
    sidebar: "",
    isHome : false,
    isPost : true,
    lang   : 'zh-CN'
  };
</script>

  <title>机械振动FFT频谱分析 | 学无止境</title>
  






  <noscript>
  <style>
  .use-motion .brand,
  .use-motion .menu-item,
  .sidebar-inner,
  .use-motion .post-block,
  .use-motion .pagination,
  .use-motion .comments,
  .use-motion .post-header,
  .use-motion .post-body,
  .use-motion .collection-header { opacity: initial; }

  .use-motion .site-title,
  .use-motion .site-subtitle {
    opacity: initial;
    top: initial;
  }

  .use-motion .logo-line-before i { left: initial; }
  .use-motion .logo-line-after i { right: initial; }
  </style>
</noscript>

</head>

<body itemscope itemtype="http://schema.org/WebPage">
  <div class="container use-motion">
    <div class="headband"></div>

    <header class="header" itemscope itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-brand-container">
  <div class="site-nav-toggle">
    <div class="toggle" aria-label="切换导航栏">
      <span class="toggle-line toggle-line-first"></span>
      <span class="toggle-line toggle-line-middle"></span>
      <span class="toggle-line toggle-line-last"></span>
    </div>
  </div>

  <div class="site-meta">

    <a href="/" class="brand" rel="start">
      <span class="logo-line-before"><i></i></span>
      <h1 class="site-title">学无止境</h1>
      <span class="logo-line-after"><i></i></span>
    </a>
      <p class="site-subtitle" itemprop="description">Do not bb, show me the example</p>
  </div>

  <div class="site-nav-right">
    <div class="toggle popup-trigger">
        <i class="fa fa-search fa-fw fa-lg"></i>
    </div>
  </div>
</div>




<nav class="site-nav">
  <ul id="menu" class="menu">
        <li class="menu-item menu-item-home">

    <a href="/" rel="section"><i class="fa fa-fw fa-home"></i>首页</a>

  </li>
        <li class="menu-item menu-item-tags">

    <a href="/tags/" rel="section"><i class="fa fa-fw fa-tags"></i>标签</a>

  </li>
        <li class="menu-item menu-item-categories">

    <a href="/categories/" rel="section"><i class="fa fa-fw fa-th"></i>分类</a>

  </li>
        <li class="menu-item menu-item-archives">

    <a href="/archives/" rel="section"><i class="fa fa-fw fa-archive"></i>归档</a>

  </li>
      <li class="menu-item menu-item-search">
        <a role="button" class="popup-trigger"><i class="fa fa-search fa-fw"></i>搜索
        </a>
      </li>
  </ul>
</nav>



  <div class="search-pop-overlay">
    <div class="popup search-popup">
        <div class="search-header">
  <span class="search-icon">
    <i class="fa fa-search"></i>
  </span>
  <div class="search-input-container">
    <input autocomplete="off" autocapitalize="off"
           placeholder="搜索..." spellcheck="false"
           type="search" class="search-input">
  </div>
  <span class="popup-btn-close">
    <i class="fa fa-times-circle"></i>
  </span>
</div>
<div id="search-result">
  <div id="no-result">
    <i class="fa fa-spinner fa-pulse fa-5x fa-fw"></i>
  </div>
</div>

    </div>
  </div>

</div>
    </header>

    
  <div class="back-to-top">
    <i class="fa fa-arrow-up"></i>
    <span>0%</span>
  </div>


    <main class="main">
      <div class="main-inner">
        <div class="content-wrap">
          

          <div class="content post posts-expand">
            

    
  
  
  <article itemscope itemtype="http://schema.org/Article" class="post-block" lang="zh-CN">
    <link itemprop="mainEntityOfPage" href="http://example.com/2021/04/11/%E6%9C%BA%E6%A2%B0%E6%8C%AF%E5%8A%A8FFT%E9%A2%91%E8%B0%B1%E5%88%86%E6%9E%90/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="image" content="/images/avatar.gif">
      <meta itemprop="name" content="xudonglei">
      <meta itemprop="description" content="搬砖 嵌入式">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="学无止境">
    </span>
      <header class="post-header">
        <h1 class="post-title" itemprop="name headline">
          机械振动FFT频谱分析
        </h1>

        <div class="post-meta">
            <span class="post-meta-item">
              <span class="post-meta-item-icon">
                <i class="fa fa-calendar-o"></i>
              </span>
              <span class="post-meta-item-text">发表于</span>

              <time title="创建时间：2021-04-11 14:54:00" itemprop="dateCreated datePublished" datetime="2021-04-11T14:54:00+08:00">2021-04-11</time>
            </span>
            <span class="post-meta-item">
              <span class="post-meta-item-icon">
                <i class="fa fa-folder-o"></i>
              </span>
              <span class="post-meta-item-text">分类于</span>
                <span itemprop="about" itemscope itemtype="http://schema.org/Thing">
                  <a href="/categories/python/" itemprop="url" rel="index"><span itemprop="name">python</span></a>
                </span>
            </span>

          
            <span id="/2021/04/11/%E6%9C%BA%E6%A2%B0%E6%8C%AF%E5%8A%A8FFT%E9%A2%91%E8%B0%B1%E5%88%86%E6%9E%90/" class="post-meta-item leancloud_visitors" data-flag-title="机械振动FFT频谱分析" title="阅读次数">
              <span class="post-meta-item-icon">
                <i class="fa fa-eye"></i>
              </span>
              <span class="post-meta-item-text">阅读次数：</span>
              <span class="leancloud-visitors-count"></span>
            </span>
  
  <span class="post-meta-item">
    
      <span class="post-meta-item-icon">
        <i class="fa fa-comment-o"></i>
      </span>
      <span class="post-meta-item-text">Valine：</span>
    
    <a title="valine" href="/2021/04/11/%E6%9C%BA%E6%A2%B0%E6%8C%AF%E5%8A%A8FFT%E9%A2%91%E8%B0%B1%E5%88%86%E6%9E%90/#valine-comments" itemprop="discussionUrl">
      <span class="post-comments-count valine-comment-count" data-xid="/2021/04/11/%E6%9C%BA%E6%A2%B0%E6%8C%AF%E5%8A%A8FFT%E9%A2%91%E8%B0%B1%E5%88%86%E6%9E%90/" itemprop="commentCount"></span>
    </a>
  </span>
  
  

        </div>
      </header>

    
    
    
    <div class="post-body" itemprop="articleBody">

      
        <p>​    这个好像是玻利维亚的一个人做的项目，在github上，仓库地址为：github.com/ariquezada/FFT-spectrum-analyzer。</p>
<h2 id="1-概述"><a href="#1-概述" class="headerlink" title="1. 概述"></a>1. 概述</h2><p>​    机械振动通常是总体机械状态的最佳指标，用于预防性和矫正性维修。可以使用加速度计来测量，可以得到一个指示振动最大值的整体读数，但是通常最有用的信息是用一个时间周期读数的FFT频谱分析来获得。</p>
<h2 id="2-ADXL335"><a href="#2-ADXL335" class="headerlink" title="2. ADXL335"></a>2. ADXL335</h2><h3 id="2-1-芯片简介"><a href="#2-1-芯片简介" class="headerlink" title="2.1 芯片简介"></a>2.1 芯片简介</h3><p>​    项目使用的是ADXL335三轴加速度传感器，下面简单介绍一下该芯片。ADXL335提供经过信号调理的电压输出，满量程加速度测量范围为±3 g，灵敏度为300±10%mV/g。它可以测量倾斜检测应用中的静态重力加速度，以及运动、冲击或振动导致的动态加速度。用户使用CX、CY 和CZ 引脚上的电容XOUT、YOUT 和ZOUT 选择该加速度计的带宽。可以根据应用选择合适的带宽，X 轴和Y 轴的带宽范围为0.5 Hz 至1600 Hz，Z 轴的带宽范围为0.5 Hz 至550 Hz。</p>
<img src="https://xdl-blog-picture.oss-cn-shanghai.aliyuncs.com/img/微信截图_20210407153959.png" style="zoom:70%;">

<img src="https://xdl-blog-picture.oss-cn-shanghai.aliyuncs.com/img/微信截图_20210407154850.png" style="zoom:77%;">

<h3 id="2-2-带宽参数的理解"><a href="#2-2-带宽参数的理解" class="headerlink" title="2.2 带宽参数的理解"></a>2.2 带宽参数的理解</h3><p>​    关于带宽的理解以及下面提到的设置依据，参考了网友的博客，原文地址为：<a target="_blank" rel="noopener" href="https://www.jianshu.com/p/772741e0b8a8">https://www.jianshu.com/p/772741e0b8a8</a> 。通俗的讲，加速度计的带宽是指能够测量到的信号的最大变化率，高于带宽的信号加速度计无法通过采样还原真实的信号变化。</p>
<p>​    将加速度计传感器静止放置，测量出来的值也会在平均值上下波动，为了降低噪声，加速度计内部通常会自带一个低通滤波器（LPF）来过滤高频分量，传感器的带宽就是指低通滤波器的带宽，高于带宽的信号变化将无法测量出来。</p>
<h3 id="2-3-带宽设置依据"><a href="#2-3-带宽设置依据" class="headerlink" title="2.3 带宽设置依据"></a>2.3 带宽设置依据</h3><p>​    直观的说，带宽设置越小，测量到的数据曲线越平滑，但信号变化会越滞后，对于高于带宽的信号变化无法测到。相反，带宽设置越大，数据曲线噪声越大，毛刺越多，但在测量数据变化的时候能够更加快速地响应其变化。</p>
<p>​    带宽的设置需根据实际测量的物体的实际变化快慢来定，在能够满足测量要求的情况下应尽量设置低的带宽，以获取更加平稳的测量数据，降低噪声，但需要高于需要测量的有效信号的变化频率。</p>
<p>​    网友是用维特智能JY61模块测量农机执行机构角度，农机的执行机构角度变化是非常缓慢的，提升或降低大约需要5-10秒时间，而实际测量到的角度中还包含了发动机带来的震动，振动频率相对较高，一般大于10Hz,这种情况下，可以将带宽设置到最低5Hz,这样可以有效过滤掉发动机抖动带来的高频振荡信号，获得更加平滑的有效测量值。</p>
<h2 id="3-做FFT频谱操作"><a href="#3-做FFT频谱操作" class="headerlink" title="3. 做FFT频谱操作"></a>3. 做FFT频谱操作</h2><p>​    实验的时候ADC在给定的采样频率（5000赫兹）上读取加速度计振动通道，为应用选择最大带宽，X和Y轴的范围为1600赫兹。Z轴的最大范围是550Hz，因此这个5000Hz的采样频率是可以的，因为采样频率大于信号最高频率的2倍，信号不会失真。</p>
<p>​    假设a是时域中的周期信号，采样频率为Fs，采样点数为N。如果A[N] = fft(a[N])，返回值A[N]是一个复数数组，其中：（原文链接：<a target="_blank" rel="noopener" href="https://blog.csdn.net/matthewwu/article/details/102621460%EF%BC%89">https://blog.csdn.net/matthewwu/article/details/102621460）</a></p>
<ul>
<li>A[0]表示频率为0hz的信号，即直流分量。</li>
<li>A[1:N/2]包含正频率项，A[N/2:]包含负频率项。正频率项就是转化后的频域信号，通常我们只需要正频率项，即前面的n/2项，负频率项是计算的中间结果（正频率项的镜像值）。</li>
<li>每一项的频率计算：假设A[i]为数组中的元素，表示一个波形，*<em>该波形的频率 = i * Fs / N*</em></li>
</ul>
<p><strong>频率分辨率概念：</strong><br>    频率分辨率是离散傅里叶变换(DFT)频域相邻刻度之间的实际频率之差。采样时，数据采样了T秒(T = 采样点数N / 采样频率Fs)，<strong>信号的成分中周期最大也就是T秒，最低频率即“基频”就等于1 / T，</strong>也就是Fs / N，这就是频率分辨率。基频 = Fs / N，各个谐波的频率就是 i * Fs / N，这个公式用于计算各个波形的频率。    </p>
<p><strong>执行的效果图：</strong></p>
<p>​    在原始仓库的基础上，把核心代码抽出来简化了一下工程，去除了一些其他的操作，比如打开文件夹选择某个文件来分析这些操作，直接对某一个文件中的数据做分析，仓库地址：<a target="_blank" rel="noopener" href="https://gitee.com/xudonglei/machinery-vibration-fft-spectrum%EF%BC%8C%E6%95%88%E6%9E%9C%E5%A6%82%E4%B8%8B%E5%9B%BE%E6%89%80%E7%A4%BA%EF%BC%9A">https://gitee.com/xudonglei/machinery-vibration-fft-spectrum，效果如下图所示：</a></p>
<img src="https://xdl-blog-picture.oss-cn-shanghai.aliyuncs.com/img/微信截图_20210411144616.png" style="zoom:67%;">


    </div>

    
    
    

      <footer class="post-footer">
          <div class="post-tags">
              <a href="/tags/%E4%BF%A1%E5%8F%B7%E5%A4%84%E7%90%86/" rel="tag"># 信号处理</a>
          </div>

        


        
    <div class="post-nav">
      <div class="post-nav-item">
    <a href="/2021/04/09/MM32F103CBT6%E5%B9%B3%E5%8F%B0%E4%B8%8A%E6%B5%8B%E8%AF%95FFT/" rel="prev" title="MM32F103CBT6平台上测试FFT">
      <i class="fa fa-chevron-left"></i> MM32F103CBT6平台上测试FFT
    </a></div>
      <div class="post-nav-item">
    <a href="/2021/04/15/MM32F103CBT6%20USB%E4%BE%8B%E7%A8%8B%E6%97%B6%E9%92%9F%E4%BF%AE%E6%94%B9/" rel="next" title="MM32F103CBT6 USB例程时钟修改">
      MM32F103CBT6 USB例程时钟修改 <i class="fa fa-chevron-right"></i>
    </a></div>
    </div>
      </footer>
    
  </article>
  
  
  



          </div>
          
    <div class="comments" id="valine-comments"></div>

<script>
  window.addEventListener('tabs:register', () => {
    let { activeClass } = CONFIG.comments;
    if (CONFIG.comments.storage) {
      activeClass = localStorage.getItem('comments_active') || activeClass;
    }
    if (activeClass) {
      let activeTab = document.querySelector(`a[href="#comment-${activeClass}"]`);
      if (activeTab) {
        activeTab.click();
      }
    }
  });
  if (CONFIG.comments.storage) {
    window.addEventListener('tabs:click', event => {
      if (!event.target.matches('.tabs-comment .tab-content .tab-pane')) return;
      let commentClass = event.target.classList[1];
      localStorage.setItem('comments_active', commentClass);
    });
  }
</script>

        </div>
          
  
  <div class="toggle sidebar-toggle">
    <span class="toggle-line toggle-line-first"></span>
    <span class="toggle-line toggle-line-middle"></span>
    <span class="toggle-line toggle-line-last"></span>
  </div>

  <aside class="sidebar">
    <div class="sidebar-inner">

      <ul class="sidebar-nav motion-element">
        <li class="sidebar-nav-toc">
          文章目录
        </li>
        <li class="sidebar-nav-overview">
          站点概览
        </li>
      </ul>

      <!--noindex-->
      <div class="post-toc-wrap sidebar-panel">
          <div class="post-toc motion-element"><ol class="nav"><li class="nav-item nav-level-2"><a class="nav-link" href="#1-%E6%A6%82%E8%BF%B0"><span class="nav-number">1.</span> <span class="nav-text">1. 概述</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#2-ADXL335"><span class="nav-number">2.</span> <span class="nav-text">2. ADXL335</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#2-1-%E8%8A%AF%E7%89%87%E7%AE%80%E4%BB%8B"><span class="nav-number">2.1.</span> <span class="nav-text">2.1 芯片简介</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#2-2-%E5%B8%A6%E5%AE%BD%E5%8F%82%E6%95%B0%E7%9A%84%E7%90%86%E8%A7%A3"><span class="nav-number">2.2.</span> <span class="nav-text">2.2 带宽参数的理解</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#2-3-%E5%B8%A6%E5%AE%BD%E8%AE%BE%E7%BD%AE%E4%BE%9D%E6%8D%AE"><span class="nav-number">2.3.</span> <span class="nav-text">2.3 带宽设置依据</span></a></li></ol></li><li class="nav-item nav-level-2"><a class="nav-link" href="#3-%E5%81%9AFFT%E9%A2%91%E8%B0%B1%E6%93%8D%E4%BD%9C"><span class="nav-number">3.</span> <span class="nav-text">3. 做FFT频谱操作</span></a></li></ol></div>
      </div>
      <!--/noindex-->

      <div class="site-overview-wrap sidebar-panel">
        <div class="site-author motion-element" itemprop="author" itemscope itemtype="http://schema.org/Person">
  <p class="site-author-name" itemprop="name">xudonglei</p>
  <div class="site-description" itemprop="description">搬砖 嵌入式</div>
</div>
<div class="site-state-wrap motion-element">
  <nav class="site-state">
      <div class="site-state-item site-state-posts">
          <a href="/archives/">
        
          <span class="site-state-item-count">283</span>
          <span class="site-state-item-name">日志</span>
        </a>
      </div>
      <div class="site-state-item site-state-categories">
            <a href="/categories/">
          
        <span class="site-state-item-count">19</span>
        <span class="site-state-item-name">分类</span></a>
      </div>
      <div class="site-state-item site-state-tags">
            <a href="/tags/">
          
        <span class="site-state-item-count">67</span>
        <span class="site-state-item-name">标签</span></a>
      </div>
  </nav>
</div>



      </div>

    </div>
  </aside>
  <div id="sidebar-dimmer"></div>


      </div>
    </main>

    <footer class="footer">
      <div class="footer-inner">
        

        

<div class="copyright">
  
  &copy; 
  <span itemprop="copyrightYear">2024</span>
  <span class="with-love">
    <i class="fa fa-user"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">xudonglei</span>
</div>
  <div class="powered-by">由 <a href="https://hexo.io/" class="theme-link" rel="noopener" target="_blank">Hexo</a> & <a href="https://muse.theme-next.org/" class="theme-link" rel="noopener" target="_blank">NexT.Muse</a> 强力驱动
  </div>

        








      </div>
    </footer>
  </div>

  
  <script src="/lib/anime.min.js"></script>
  <script src="/lib/velocity/velocity.min.js"></script>
  <script src="/lib/velocity/velocity.ui.min.js"></script>

<script src="/js/utils.js"></script>

<script src="/js/motion.js"></script>


<script src="/js/schemes/muse.js"></script>


<script src="/js/next-boot.js"></script>




  




  
<script src="/js/local-search.js"></script>













  

  


<script>
NexT.utils.loadComments(document.querySelector('#valine-comments'), () => {
  NexT.utils.getScript('//unpkg.com/valine/dist/Valine.min.js', () => {
    var GUEST = ['nick', 'mail', 'link'];
    var guest = 'nick,mail,link';
    guest = guest.split(',').filter(item => {
      return GUEST.includes(item);
    });
    new Valine({
      el         : '#valine-comments',
      verify     : false,
      notify     : false,
      appId      : 'BT0Qw9HcTpPv1a6cT1iDBXKz-gzGzoHsz',
      appKey     : 'LMCMh8v02JTMFAwKNRcgoizI',
      placeholder: "Just go go",
      avatar     : 'mm',
      meta       : guest,
      pageSize   : '10' || 10,
      visitor    : true,
      lang       : 'zh-CN' || 'zh-cn',
      path       : location.pathname,
      recordIP   : false,
      serverURLs : ''
    });
  }, window.Valine);
});
</script>

</body>
</html>
